<!-- 多列拖动: clone方式 -->
<template>
  <div>
    <p>
      arr: {{ arr }}
    </p>
    <p>
      targetArr: {{ targetArr }}
    </p>
    <div class="container">
      <div class="left panel">
        <draggable :list="arr" :group="groupInfo" animation="500" class="fullHeight">
          <div v-for="item in arr" :key="item.id">{{ item.name }}</div>
        </draggable>
      </div>
      <div class="right panel">
        <draggable :list="targetArr" :group="groupInfo" animation="500" class="fullHeight">
          <div v-for="item in targetArr" :key="item.id">{{ item.name }}</div>
        </draggable>
      </div>
    </div>
  </div>
</template>

<script>
import {defineComponent, reactive, ref} from "vue";
import {VueDraggableNext as draggable} from 'vue-draggable-next'

export default defineComponent({
  setup() {
    const arr = reactive([
      {id: 1, name: '张三'},
      {id: 2, name: '李四'},
      {id: 3, name: '王五'},
      {id: 4, name: '赵六'},
      {id: 5, name: '孙七'}
    ])
    const targetArr = reactive([]);
    const groupInfo = {
      name: 'test02',
      pull: 'clone'
    }
    return {arr, targetArr, groupInfo}
  },
  components: {draggable}
})
</script>

<style scoped>
.container {
  width: 100%;
  height: 300px;
}

.panel {
  float: left;
  height: 300px;
}

.fullHeight {
  height: 100%;
}

.fullHeight div {
  height: 28px;
  line-height: 28px;
  text-align: center;
  margin-bottom: 5px;
  background-color: #eee;
  cursor: move;
}

.fullHeight div:hover {
  background-color: #f3f3f3;
}

.left {
  width: 40%;
  background-color: lightgoldenrodyellow;
}

.right {
  width: 59%;
  margin-left: 1%;
  background-color: lightcyan;
}
</style>